package com.yupi.oj.ojMQ.orderMQ;

import com.yupi.oj.model.entity.VoucherOrder;
import com.yupi.oj.ojMQ.Ojconstant;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class OrderMessageProducer {
    @Resource
    private RabbitTemplate rabbitTemplate;

    //绑定自定义命名的交换机名称和路由关键字
    public void sendMessage(VoucherOrder message){
        rabbitTemplate.convertAndSend(orderConstant.EXCHANGE_NAME,orderConstant.ROUTING_KEY ,message);
    }
}
